//
//  MyFamilyViewController.m
//  WheatPlan
//
//  Created by giantumbrella on 15/5/21.
//  Copyright (c) 2015年 IOSTeam. All rights reserved.
//

#import "MyFamilyViewController.h"

@interface MyFamilyViewController ()

@end

@implementation MyFamilyViewController
MM_SP
- (void)viewDidLoad {
    [super viewDidLoad];
    
    //设置导航栏头文字
    self.navigationItem.title = @"我家";
    //设置导航栏背景颜色
    [self.navigationController.navigationBar setBarTintColor:UIColorWithRGBA(0,215,226,1)];
    //设置导航栏字体颜色
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor,nil]];
    UIBarButtonItem *rightBtn = [[UIBarButtonItem alloc]
                                 initWithTitle:@"宝宝"
                                 style:UIBarButtonItemStylePlain
                                 target:self
                                 action:@selector(turntoBaby)];
    self.navigationItem.rightBarButtonItem = rightBtn;
    
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(-20, 0, SCREEN_WIDTH+20, SCREEN_HEIGHT) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    //隐藏分割线
     _tableView.separatorStyle = UITableViewCellEditingStyleNone;
    [self.view addSubview:_tableView];
    
    _tableView.backgroundColor = UIColorWithRGBA(232, 232, 232, 1);

    
    // Do any additional setup after loading the view from its nib.
}
-(void)turntoBaby{
    

    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark--- tableViewDelegate 每个区的行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    if (section==0) {
        return 1;
        
    }else if (section == 1){
        
        return 3;
    }else{
        
        return 2;
    }
}

#pragma mark--- tableViewDelegate 区尾的高度

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    
    if (section == 2) {
        return 0;
    } else {
        return 27;
        
    }
    
}
#pragma mark--- tableViewDelegate cell

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *NOTIFY = @"cell";
    UITableViewCell *cell = (UITableViewCell *)[tableView dequeueReusableCellWithIdentifier:NOTIFY];
    if (cell==nil) {
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NOTIFY];
        
    }
    //左右图片
    if (indexPath.section == 0) {
        _tableView.rowHeight = 130;
        
    } else {
        
        if (indexPath.section ==1)
        {
            _tableView.rowHeight = 40;
            
            
            if (IS_IPHONE_6) {
                
                
                _image = [[UIImageView alloc]init];
                _image.frame = [self orange:30 orangey:5 sizewith:20 sizeheigt:20];
                _image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.png",indexPath.row+1]];
                [cell addSubview:_image];
                
                _image1 = [[UIImageView alloc]init];
                _image1.frame = [self orange:280 orangey:3 sizewith:25 sizeheigt:25];
                _image1.image = [UIImage imageNamed:@"6.png"];
                [cell addSubview:_image1];
                
                _image2 = [[UIImageView alloc]init];
                _image2.frame = [self orange:315 orangey:7 sizewith:15 sizeheigt:20];
                _image2.image = [UIImage imageNamed:@"7.png"];
                [cell addSubview:_image2];
            }else{
                
                _image = [[UIImageView alloc]init];
                _image.frame = [self orange:30 orangey:10 sizewith:20 sizeheigt:20];
                _image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.png",indexPath.row+1]];
                [cell addSubview:_image];
                
                _image1 = [[UIImageView alloc]init];
                _image1.frame = [self orange:280 orangey:5 sizewith:25 sizeheigt:25];
                _image1.image = [UIImage imageNamed:@"6.png"];
                [cell addSubview:_image1];
                
                _image2 = [[UIImageView alloc]init];
                _image2.frame = [self orange:315 orangey:7 sizewith:15 sizeheigt:20];
                _image2.image = [UIImage imageNamed:@"7.png"];
                [cell addSubview:_image2];
                
                
            }
      
        
            
        }
        
        
        if (indexPath.section ==2)
        {
            
            _tableView.rowHeight = 40;
            
            
            
            
            if (IS_IPHONE_6) {
                
                
                _image = [[UIImageView alloc]init];
                _image.frame = [self orange:30 orangey:5 sizewith:20 sizeheigt:20];
                _image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.png",indexPath.row+1]];
                [cell addSubview:_image];
                
                _image1 = [[UIImageView alloc]init];
                _image1.frame = [self orange:280 orangey:3 sizewith:25 sizeheigt:25];
                _image1.image = [UIImage imageNamed:@"6.png"];
                [cell addSubview:_image1];
                
                _image2 = [[UIImageView alloc]init];
                _image2.frame = [self orange:315 orangey:7 sizewith:15 sizeheigt:20];
                _image2.image = [UIImage imageNamed:@"7.png"];
                [cell addSubview:_image2];
            }else{
                
                _image = [[UIImageView alloc]init];
                _image.frame = [self orange:30 orangey:5 sizewith:20 sizeheigt:20];
                _image.image = [UIImage imageNamed:[NSString stringWithFormat:@"%ld.png",indexPath.row+1]];
                [cell addSubview:_image];
                
                _image1 = [[UIImageView alloc]init];
                _image1.frame = [self orange:280 orangey:5 sizewith:25 sizeheigt:25];
                _image1.image = [UIImage imageNamed:@"6.png"];
                [cell addSubview:_image1];
                
                _image2 = [[UIImageView alloc]init];
                _image2.frame = [self orange:315 orangey:7 sizewith:15 sizeheigt:20];
                _image2.image = [UIImage imageNamed:@"7.png"];
                [cell addSubview:_image2];
                
                
            }
        }

        
    }
    
    
    
    
    
    
    
    //cell上面的字
    if (indexPath.section == 0 ) {
        
        if (indexPath.row == 0) {
            
            if
                (IS_IPHONE_6)
            {
                UIImageView * image = [[UIImageView alloc]init];
                image.frame = [self orange:18 orangey:0 sizewith:320 sizeheigt:95];
                image.image = [UIImage imageNamed:@"_0001_圆角矩形-2"];
                [cell addSubview:image];
            }
            else if (IS_IPHONE_4_OR_LESS){
                
                
                UIImageView * image = [[UIImageView alloc]init];
                image.frame = [self orange:20 orangey:0 sizewith:320 sizeheigt:130];
                image.image = [UIImage imageNamed:@"_0001_圆角矩形-2"];
                [cell addSubview:image];
                
            }
            else
            {
                
                
                
                UIImageView * image = [[UIImageView alloc]init];
                image.frame = [self orange:20 orangey:0 sizewith:320 sizeheigt:110];
                image.image = [UIImage imageNamed:@"_0001_圆角矩形-2"];
                [cell addSubview:image];
                
            }
     
            if
                (IS_IPHONE_6)
            {
                UILabel * lab = [[UILabel alloc]init];
                lab.frame = [self orange:20 orangey:10 sizewith:330 sizeheigt:45];
                lab.text = @"您的奥特曼已经2岁了";
                lab.font = [UIFont systemFontOfSize:22];
                lab.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab];
                
                UILabel * lab1 = [[UILabel alloc]init];
                lab1.frame = [self orange:20 orangey:50 sizewith:340/2 sizeheigt:45];
                lab1.text = @"身高：120--130m";
                lab1.font = [UIFont systemFontOfSize:15];
                lab1.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab1];
                
                UILabel * lab2 = [[UILabel alloc]init];
                lab2.frame = [self orange:340/2+10 orangey:50 sizewith:340/2 sizeheigt:45];
                lab2.text = @"体重：12--15t";
                lab2.font = [UIFont systemFontOfSize:15];
                lab2.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab2];
        
            }
            else
                if
                (IS_IPHONE_4_OR_LESS)
            {
                
                
                UILabel * lab = [[UILabel alloc]init];
                lab.frame = [self orange:20 orangey:10 sizewith:330 sizeheigt:45];
                lab.text = @"您的奥特曼已经2岁了";
                lab.font = [UIFont systemFontOfSize:22];
                lab.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab];
                
                UILabel * lab1 = [[UILabel alloc]init];
                lab1.frame = [self orange:20 orangey:70 sizewith:340/2 sizeheigt:45];
                lab1.text = @"身高：120--130m";
                lab1.font = [UIFont systemFontOfSize:15];
                lab1.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab1];
                
                UILabel * lab2 = [[UILabel alloc]init];
                lab2.frame = [self orange:340/2+10 orangey:70 sizewith:340/2 sizeheigt:45];
                lab2.text = @"体重：12--15t";
                lab2.font = [UIFont systemFontOfSize:15];
                lab2.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab2];
                
    
                
            }else
            {
                
                UILabel * lab = [[UILabel alloc]init];
                lab.frame = [self orange:20 orangey:10 sizewith:330 sizeheigt:45];
                lab.text = @"您的奥特曼已经2岁了";
                lab.font = [UIFont systemFontOfSize:22];
                lab.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab];
                
                UILabel * lab1 = [[UILabel alloc]init];
                lab1.frame = [self orange:20 orangey:60 sizewith:340/2 sizeheigt:45];
                lab1.text = @"身高：120--130m";
                lab1.font = [UIFont systemFontOfSize:15];
                lab1.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab1];
                
                UILabel * lab2 = [[UILabel alloc]init];
                lab2.frame = [self orange:340/2+10 orangey:60 sizewith:340/2 sizeheigt:45];
                lab2.text = @"体重：12--15t";
                lab2.font = [UIFont systemFontOfSize:15];
                lab2.textAlignment = UITextAlignmentCenter;
                [cell addSubview:lab2];
        
            }

    
        }
        
    }
    
    
    
    if(indexPath.section == 1){
        
        if (indexPath.row == 0) {
            // cell.textLabel.frame = CGRectMake(0, 20, 355, 50);
            cell.textLabel.text = @"             上门早教";
            cell.textLabel.font = [UIFont systemFontOfSize:14];
            
        } else if(indexPath.row ==1)
        {
            cell.textLabel.text = @"             同城解读";
            cell.textLabel.font = [UIFont systemFontOfSize:14];
            
            
        }else if (indexPath.row ==2){
            
            cell.textLabel.text = @"             户外亲子";
            cell.textLabel.font = [UIFont systemFontOfSize:14];
            
        }
    }
    if (indexPath.section == 2) {
        if (indexPath.row == 0) {
            cell.textLabel.text = @"             消息中心";
            cell.textLabel.font = [UIFont systemFontOfSize:14];
            
        } else if(indexPath.row ==1)
        {
            cell.textLabel.text = @"             设置";
            cell.textLabel.font = [UIFont systemFontOfSize:14];
            
            
        }
    }
    
    
    return cell;
    
    
}
#pragma mark--- tableViewDelegate 有几个区
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 3;
    
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (indexPath.section==2) {
        if (indexPath.row == 0) {
            
        } else if(indexPath.row ==1)
        {

        }
        
    }
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
